package com.wc.AlgoOJ_homework.ALOJ模块测试Ⅲ.C_回路计数;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/5/19 13:03
 * @description http://43.138.190.70:8888/p/641?tid=66444686c0c2f98e569f403b
 */
public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 22, M = 1 << N;
//    static int[][] state = new int[N][M];
//    static long[][] f = new long[M][N];
//    static int len = 0;
    static int n;
    static long[] ans = new long[]{0, 1, 1, 2, 2, 12, 4, 72, 72, 720, 576, 22032, 7776, 476928, 400896, 6352992,
            8515584, 805146624, 279023616, 36481536000L, 23627980800L, 881012367360L};

    public static void main(String[] args) {
        n = sc.nextInt();
//        for (n = 1; n <= 21; n++) {
//            for (int i = 0; i < 1 << n; i++) {
//                Arrays.fill(f[i], 0, n, 0);
//            }
//            for(int i = 1; i <= n; i++) state[i][0] = 0;
//
//            for (int i = 1; i < 1 << n; i += 2) {
//                int cnt = check(i);
//                state[cnt][++state[cnt][0]] = i;
//            }
//            f[1][0] = 1;
//            for (int cnt = 2; cnt <= n; cnt++) {
//                for (int i = 1; i <= state[cnt][0]; i++) {
//                    int st = state[cnt][i];
//                    for (int j = 1; j < n; j++) {
//                        for (int k = 0; k < n; k++) {
//                            if ((st >> k & 1) == 1 && gcd(j + 1, k + 1) == 1) {
//                                f[st][j] += f[st ^ (1 << j)][k];
//                            }
//                        }
//                    }
//                }
//            }
//            long res = 0;
//            for (int i = 1; i < n; i++) res += f[(1 << n) - 1][i];
//            out.printf("%d %d\n", n, res);
//        }
        out.println(ans[n]);
        out.flush();
    }

    static int check(int x) {
        int res = 0;
        for (int i = 0; i < n; i++) {
            res += x >> i & 1;
        }
        return res;
    }

    static int gcd(int a, int b) {
        return b > 0 ? gcd(b, a % b) : a;
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}